<%-- 
    Document   : editItemInformation
    Created on : Sep 1, 2011, 3:49:35 PM
    Author     : Mikeno
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link rel="stylesheet" href="../style/desk.css" type="text/css" />
        <link rel="stylesheet" href="../style/960.css" type="text/css" />
        <link rel="stylesheet" href="../style/960_12_col.css" type="text/css" />
        <link rel="stylesheet" href="../style/calendarview.css" type="text/css" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Edit Item </title>
        <script src="../scripts/validation.js"></script>
        <script src="../scripts/prototype.js"></script>
        <script src="../scripts/calendarview.js"></script>
        <script>
            function setupCalendars() {

                // Popup Calendar
                Calendar.setup(
                {
                    dateField: 'expiry',
                    triggerElement: 'expiry'
                }
            )
            }

            Event.observe(window, 'load', function() { setupCalendars() })
        </script>
    </head>
    <body>

        <div class="suffix_12"></div>
        <br>
        <div class="container_12">
            <form action ="/HyperMarket/EditItemInformationServlet" name ="editinfo" method ="post" >
                <div class="grid_3">


                    <!-- Item Name-->
                    <br>
                    <label id="itemname_label"> Item's Name : </label><br>
                    <input class="txtinput" id="itemname" type="text" name="itemname" onkeyup="nameTimer(this)" value=<%= request.getParameter("name")%>>
                    <div style="display:block;" id="erroritemname"></div>

                    <!--Expiry Date-->

                    <label id="expiry_label" class="inputlabel medlabel">Expiry Date : </label>
                    <div id="popupExample">
                        <input type="text" id="expiry" class="dateField" name="expiry" value="<%= request.getParameter("expiry")%>">
                    </div>
                    
                    <!--Cost Price-->

                    <label id="costprice_label" class="inputlabel medlabel">Cost Price : $ </label>
                    <input class="txtinput" type="text" id="cost"  onkeyup="priceTimer(this)" name="cost" value=<%= request.getParameter("cost")%>>
                    <div style="display:block;" id ="errorcost"></div>

                    <!--Threshold-->

                    <label id="threshold_label" class="inputlabel medlabel">Set Threshold Level : </label>
                    <input class="txtinput" type="text" id="threshold" onkeyup="intTimer(this)" name="threshold" value=<%= request.getParameter("threshold")%>>
                    <div style="display:block;" id ="errorthreshold"></div>

                    <!--Quantity-->
                    <label id="quantity_label" class="inputlabel medlabel"> Quantity : </label>
                    <input class="txtinput" type="text" id="quantity" onkeyup="intTimer(this)" name="quantity" value=<%= request.getParameter("quantity")%>>
                    <div style="display:block;" id ="errorquantity"></div>


                    <!-- hidden fields -->
                    <input type="hidden" id="stockid" name="stockid" value=<%= request.getParameter("id")%>>
                    <input type="hidden" id="quantity" name="quantity" value=<%= request.getParameter("quantity")%>>
                    <input type="hidden" id="store" name="store" value=<%=request.getParameter("storeid")%>>

                </div>
                <div class="grid_4 suffix_5" id="imagediv">

                    <% String image = request.getParameter("image");
                                out.println("<img src=\"../product/" + image + "\" height=\"125\" width=\"200\">");
                    %>
                    <br>
                    <!--Status-->
                    <label id="status_label" class="inputlabel medlabel">  Status :
                        <% String stat = request.getParameter("status");
                                    if (stat.equals("Available")) {
                                        out.println("<font color='#FF4759'> Available </font>");
                                    } else if (stat.equals("Out Of Stock")) {
                                        out.println("<font color='#8C8066'> Out Of Stock </font>");
                                    } else if (stat.equals("Ordering")) {
                                        out.println("<font color='#8C8066'> Ordering </font>");
                                    } else {
                                        out.println("<font color='#FFCC26'> Low in Stock </font>");
                                    }
                        %>  </label>

                    <!--Selling Price-->
                    <div id="sellingprice_div">
                        <label id="sellingprice_label" class="inputlabel medlabel">Usual Selling Price : $</label>
                        <input class="txtinput3" type="text" onkeyup="priceTimer(this)" id="selling" name="selling" value=<%= request.getParameter("selling")%>>
                        <div style="display:block;" id ="errorselling"></div>
                    </div>

                    <!--Discount-->
                    <div id="discount_div">
                        <label id="discount_label" class="inputlabel medlabel">Discount : %</label>
                        <input class="txtinput3" type="text" onkeyup="discountTimer(this)" id="discount" name="discount" value=<%= request.getParameter("discount")%>>
                        <div style="display:block;" id ="errordiscount"></div>
                    </div>
                </div>
                <br>
                <div class=" prefix_2 grid_2 suffix_7">
                    <div id="button_location">
                        <button id="update" class="ovaction ovactionbig ovactionprimary" style="margin: 5px 10px 0 -1px;" onclick="return submitUpdates(this.form)">Update Stock</button>
                    </div>
                </div>
            </form>
        </div>

    </body>
</html>